var searchPact = function(){
	
	var ps = new ProjectSourceDemo();
	var thiz=this;
	
	var searchName = new Ext.form.TextField({
		fieldLabel : '合同名称',
		width : 150
	});
	var btn_search = new Ext.Button({
		text : '查询',
		iconCls: 'icon-search',
		handler: function (){
			pactStore.load();
			}
	});
	var pactStore = new Ext.data.JsonStore(
			{
				url : '../pact/searchPact.form?status=10&timesnap=' + new Date().getTime(),
				root : 'result',
				fields : [  'pactID', 'customerID', 'customerArea',
							'pactType', 'pactMoney', 'pactRemark',
							'pactSuccessName', 'pactMoneyType', 'pactName', 'pactEndDate',
							'pactStartDate', 'pactSuccessDate', 'CreateBy', 'CreateTime','LastUpdateBy',
							'LastUpdateDate', 'pactstage', 'customerName'],
				listeners : {
					scope : this,
					beforeload : function(thiz) {
						thiz.baseParams = {
							searchName : searchName.getValue()
						};
					}
				}
			});
	var createGrid = new Ext.grid.GridPanel({
		width : 930,
		height : 250,
		store : pactStore,
		scope : this,
		listeners : {
			scope : this,
			rowmousedown : function(grid,index,e){
				var data = grid.store.getAt(index).data;
				ps.setPactValue(data);
		       
			}
		},
		columns : [ {header:'合同名称',width: 150,sortable: true,dataIndex:'pactName'},
					{header:'客户名称',width: 150,sortable: true,dataIndex:'customerName'},
			        {header:'状态',width: 100, sortable: true,dataIndex:'pactstage',renderer:function(value){return OMS.PACTSTAGE[value];}},
			        {header:'合同类型',dataIndex:'pactType',renderer:function(value,row){return OMS.PACTTYPE[value];}},
			        {header:'签约人',dataIndex:'pactSuccessName'},
			        {header:'签约日期',width: 170,dataIndex:'pactSuccessDate'}],
       bbar:new Ext.PagingToolbar({
		 pageSize: 10,
         store: pactStore,
         displayInfo: true,
         displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
         emptyMsg: "没有记录..."
       })
	});
	this.searchPactPanel= new Ext.form.FormPanel({
		frame : true,
		width : 950,
		labelWidth : 85,
		items : [{layout:'column',defaults:{layout:'form'},
			      items:[{columnWidth:0.4,items:[searchName]},
			             {columnWidth:0.2,items:[btn_search]}]
				 },createGrid],
	    listeners: {
	    	render: {fn:function(){pactStore.load();}}
	   		    }
	});
};